import App from './App'
import uView from "uview-ui";
Vue.use(uView);

import { default as utils } from '@/utils/common.js'
import { noMultipleClicks } from '@/utils/util.js'
import axios from '@/utils/request.js'

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'

// 引入和风天气图标
import 'qweather-icons/font/qweather-icons.css'
import '@/static/css/stylesheet.css'

Vue.config.productionTip = false
Vue.prototype.$utils = utils
Vue.prototype.$https = axios.request

// 按钮防止重复点击
Vue.prototype.$noMultipleClicks = noMultipleClicks;

// 使用方式 button v-prevent-click="1000">提交</button>
Vue.directive('prevent-click', {
	inserted(el, binding) {
		el.addEventListener('click', () => {
			if (!el.disabled) {
				el.disabled = true
				setTimeout(() => el.disabled = false, binding.value || 1500)
			}
		})
	}
})

App.mpType = 'app'
const app = new Vue({
	...App
})
app.$mount()
// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
export function createApp() {
	const app = createSSRApp(App)
	return {
		app
	}
}
// #endif